package com.hm.jiaowuxitong.ui;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JFrame;


public class TeacherGui {
    public TeacherGui(){
        JFrame frame=new JFrame("教师");
        frame.setSize(1200,700);
        //创建画布
        //创建画布
        JPanel panel = new JPanel(new BorderLayout());
        //创建方向布局
        SpringLayout layout = new SpringLayout();
        panel.setLayout(layout);
        JButton button1=new JButton("增加学生信息");
        layout.putConstraint(SpringLayout.WEST, button1, 70, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button1, 70, SpringLayout.NORTH, panel);
        button1.setFont(new Font(" ", 2, 30));
        JButton button2=new JButton("删除学生信息");
        layout.putConstraint(SpringLayout.WEST, button2, 70, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button2, 150, SpringLayout.NORTH, panel);
        button2.setFont(new Font(" ", 2, 30));
        JButton button3=new JButton("修改学生信息");
        layout.putConstraint(SpringLayout.WEST, button3, 70, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button3, 230, SpringLayout.NORTH, panel);
        button3.setFont(new Font(" ", 2, 30));
        JButton button4=new JButton("查找学生信息");
        layout.putConstraint(SpringLayout.WEST, button4, 70, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button4, 310, SpringLayout.NORTH, panel);
        button4.setFont(new Font(" ", 2, 30));

        JButton button10=new JButton("查询课表");
        layout.putConstraint(SpringLayout.WEST, button10, 70, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button10, 390, SpringLayout.NORTH, panel);
        button10.setFont(new Font(" ", 2, 30));

        JButton button5=new JButton("录入学生成绩");
        layout.putConstraint(SpringLayout.WEST, button5, 370, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button5, 70, SpringLayout.NORTH, panel);
        button5.setFont(new Font(" ", 2, 30));
        JButton button6=new JButton("修改学生成绩");
        layout.putConstraint(SpringLayout.WEST, button6, 370, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button6, 150, SpringLayout.NORTH, panel);
        button6.setFont(new Font(" ", 2, 30));
        JButton button7=new JButton("查询学生成绩");
        layout.putConstraint(SpringLayout.WEST, button7, 370, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button7, 230, SpringLayout.NORTH, panel);
        button7.setFont(new Font(" ", 2, 30));
        JButton button8=new JButton("查询教师");
        layout.putConstraint(SpringLayout.WEST, button8, 70, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button8, 310, SpringLayout.NORTH, panel);
        button8.setFont(new Font(" ", 2, 30));

        JButton button11=new JButton("修改密码");
        layout.putConstraint(SpringLayout.WEST, button10, 50, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button10, 390, SpringLayout.NORTH, panel);
        button10.setFont(new Font(" ", 2, 30));


        JButton button9=new JButton("退出登录");
        layout.putConstraint(SpringLayout.WEST, button9, 400, SpringLayout.WEST, panel);
        layout.putConstraint(SpringLayout.NORTH, button9, 450, SpringLayout.NORTH, panel);
        button9.setFont(new Font(" ", 2, 30));

        // 创建标题标签
        JLabel label = new JLabel("风景一览");
        label.setForeground(new Color(7, 96, 186));
        Font font = new Font(label.getFont().getName(), Font.PLAIN, 30);
        label.setFont(font);
        layout.putConstraint(SpringLayout.NORTH,label,5,SpringLayout.NORTH,panel);
        layout.putConstraint(SpringLayout.EAST,label,-70,SpringLayout.EAST,panel);

        JLabel img1=new JLabel();
        ImageIcon imageIcon1 = new ImageIcon("image/img_5.png");  // 将"path/to/your/image.jpg"替换为你的图片路径
        img1.setIcon(imageIcon1);

        layout.putConstraint(SpringLayout.NORTH,img1,100,SpringLayout.NORTH,panel);
        layout.putConstraint(SpringLayout.EAST,img1,-20,SpringLayout.EAST,panel);
        label.setPreferredSize(new Dimension(200,80));
        panel.add(label);

        JLabel img=new JLabel();
        ImageIcon imageIcon = new ImageIcon("image/4.jpg");  // 将"path/to/your/image.jpg"替换为你的图片路径
        img.setIcon(imageIcon);

        panel.add(button1);
        panel.add(button2);
        panel.add(button3);
        panel.add(button4);
        panel.add(button5);
        panel.add(button6);
        panel.add(button7);
        panel.add(button8);
        panel.add(button9);
        panel.add(button10);
        panel.add(button11);

        panel.add(img1);
        panel.add(img);


        button1.setBorderPainted(false);//不显示按钮的边框。
        button1.setRolloverEnabled(true);//启用按钮悬停效果。
        button2.setBorderPainted(false);//不显示按钮的边框。
        button2.setRolloverEnabled(true);//启用按钮悬停效果。
        button3.setBorderPainted(false);//不显示按钮的边框。
        button3.setRolloverEnabled(true);//启用按钮悬停效果。
        button4.setBorderPainted(false);//不显示按钮的边框。
        button4.setRolloverEnabled(true);//启用按钮悬停效果。
        button5.setBorderPainted(false);//不显示按钮的边框。
        button5.setRolloverEnabled(true);//启用按钮悬停效果。
        button6.setBorderPainted(false);//不显示按钮的边框。
        button6.setRolloverEnabled(true);//启用按钮悬停效果。
        button7.setBorderPainted(false);//不显示按钮的边框。
        button7.setRolloverEnabled(true);//启用按钮悬停效果。
        button8.setBorderPainted(false);//不显示按钮的边框。
        button8.setRolloverEnabled(true);//启用按钮悬停效果。
        button9.setBorderPainted(false);//不显示按钮的边框。
        button9.setRolloverEnabled(true);//启用按钮悬停效果。
        button10.setBorderPainted(false);//不显示按钮的边框。
        button10.setRolloverEnabled(true);//启用按钮悬停效果。
        button11.setBorderPainted(false);//不显示按钮的边框。
        button11.setRolloverEnabled(true);//启用按钮悬停效果。

        //把画布添加至面板
        frame.setContentPane(panel);
        //禁止面板放大缩小
        frame.setResizable(false);
        //允许关闭整个应用
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //将面板显示
        frame.setVisible(true);
        // 设置窗口居中显示
        frame.setLocationRelativeTo(null);
        // 显示窗口
        frame.setVisible(true);
        //添加点击事件
        button1.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new AddStudentInfoUI(1);
                frame.dispose();

            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button2.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new DeleteStudentInfoUI(1);
                frame.dispose();
            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button3.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new DeleteStudentInfoUI(1);
                frame.dispose();
            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button4.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new ShowStudentGui();
                frame.dispose();
            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button5.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new AddGradeInfoUI();
                frame.dispose();
            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button6.addMouseListener(new MouseListener() {//修改学生成绩
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new UpdataCourseInfoUI();
                frame.dispose();
            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button7.addMouseListener(new MouseListener() {//查询成绩
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new ShowStudentGradeButton();
                frame.dispose();
            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button8.addMouseListener(new MouseListener() {//查询教师
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new ShowSelfTeacherButton();
                frame.dispose();
            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button9.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new GifTest();
                frame.dispose();
            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button10.addMouseListener(new MouseListener() {//查询课表
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new TeacherCourseInfoUI();
                frame.dispose();
            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
        button11.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {

            }

            @Override
            public void mousePressed(MouseEvent e) {
                new ChangeTeacherPassword();
                frame.dispose();
            }

            @Override
            public void mouseReleased(MouseEvent e) {

            }

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {

            }
        });
    }

    public static void main(String[] args) {
        new TeacherGui();
    }
}
